﻿<%@page import="weaver.general.Util"%>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %> 
<%@ include file="/systeminfo/init_wev8.jsp" %> 
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<%
	int requestid = Util.getIntValue(request.getParameter("requestid"),0);//请求id
	int workflowid = Util.getIntValue(request.getParameter("workflowid"));//流程id
	int formid = Util.getIntValue(request.getParameter("formid"));//表单id
	int isbill = Util.getIntValue(request.getParameter("isbill"));//表单类型，1单据，0表单
	int nodeid = Util.getIntValue(request.getParameter("nodeid"));//流程的节点id
	int scoreid = Util.getIntValue(request.getParameter("scoreid"));//scoreid
%>
<%--位于工单流程第一节点 用来判断工单明细中 是否有重复的选项和库存是否充足  --%>
<script type="text/javascript">
jQuery(document).ready(function(){
	checkCustomize = function(){
		var newArray = new Array();
		var nextArray = new Array();
		var submitdtlid0 = jQuery("#submitdtlid0").val();
		var array = submitdtlid0.split(",");
		for(var i=0; i<array.length; i++){
			var pxbm = jQuery("#field6077_"+array[i]).val();
			var sl = jQuery("#field6047_"+array[i]).val();
			if(pxbm != ""){
				newArray.push(pxbm);
			}
			if(pxbm != "" && sl != ""){
				nextArray.push(pxbm+"@"+sl);
			}
		}
		for(var j = 0; j < newArray.length-1; j++){
			for(var k = j+1; k < newArray.length; k++){
				if(jQuery.trim(newArray[j]) == jQuery.trim(newArray[k])){
					alert("品项编码,请重新输入!");
					return false;
				}
			}
		} 
		//alert(nextArray.join());打印数组
		checkbox(nextArray);
		return true; 
	}
	
	//检查明细表的品相编码在库数量是否充足,如果在库不足给予提示,但不干预流程的提交
	function checkbox(array){
		jQuery.ajax({
			url:"/interface/haozhi/check.jsp",
			dataType : "text",  	//传递的数据类型
	    	type : "post",      	//传递方式
	    	async : false,
	    	data : {
	    		"array" : array.join()			
	    	},
	    	success: function(text){
	    		var mes = jQuery.trim(text); 
	    		if(mes != "" && mes != null){
		    		alert(mes);
	    		}
	    	}
		});
	} 
});
</script>




